/***************************************************************************
创建者：华磊
开始时间：               : 2019.12.13
copyright            : (C) 深圳市华友高科有限公司
修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 ***************************************************************************
 *   xx
 *                                                                         *
 ***************************************************************************/
#ifndef BELTTRACKVIEW_H
#define BELTTRACKVIEW_H
#include "../CommunicateDelegate/gSoapFoundation/soapStub.h"

#include <QDialog>

namespace Ui {
class BeltTrackView;
}
class QStandardItemModel;
class CommunicateNormalDelegate;
class GlobalData;

class BeltTrackView : public QDialog
{
    Q_OBJECT

public:
    explicit BeltTrackView(int styleId,CommunicateNormalDelegate *communicateNormalThreadIn,
                           GlobalData *globalDataIn,QWidget *parent = 0);
    ~BeltTrackView();

    void initialDisplayStyle(int styleId);

public slots:
    void showView_slot();

private slots:
    void on_pushButton_return_clicked();

    void on_pushButton_changeVisionConfig_clicked();

    void on_comboBox_visionIndex_currentIndexChanged(int index);

    void on_pushButton_changeTrackConfig_clicked();

    void on_comboBox_currenttrackIndex_currentIndexChanged(int index);

    void on_pushButton_recordAPointValue_clicked();

    void on_pushButton_recordBPoint_clicked();

private slots:
    void timeOutSlot();

    void on_comboBox_visionIndex_activated(int index);

    void on_comboBox_currenttrackIndex_activated(int index);

    void on_pushButton_forceTrigCamera_clicked();

    void on_pushButton_recordCameraPoint_clicked();

    void on_pushButton_recordARobotPoint_clicked();

    void on_pushButton_calculateCameraOffset_clicked();

    void on_pushButton_connectCamera_clicked();

private:
    void getVisionConfig_Info();
    void getTrackConfig_Info();

    double getActualMovedDistance(int oldValue, int newValue, int encoderDirection, double transmission);
    void updateVisionConfigShow(int visionIndex,VisionTrackConfig visionConfig);
    void updateTrackConfigShow(int trackIndex,BeltTrackConfig beltConfig);
    int displayVisionTrackDebugInfo();
    int displayBeltTrackDebugInfo();
    int displayEncoderReceiver(EncoderReceiverData infoIn);
    int getEncoderValue(int aliasIn, int encoderIndexIn, int &encoderValueOut);


private:
    QTimer *timer;
    Ui::BeltTrackView *ui;
    CommunicateNormalDelegate *communicateNormalThread;
    GlobalData *globalData;
    std::vector<VisionTrackConfig> visionConfigList;
    std::vector<BeltTrackConfig> beltConfigList;
    QStandardItemModel* model_encoderReceiverInfo;
    QStandardItemModel* model_beltTrackDebugInfo;
};

#endif // BELTTRACKVIEW_H
